<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
	
	private $tab = 'global';
	function __construct(){
		parent::__construct();
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	function index(){
		// 简单运营数据
		/***
		 * 统计在线人数，模糊统计，登陆 30分钟内的人数
		 * */
		$this->load->model('systemadmin_model','sa');
		$data['admin_count'] = $this->sa->get_online_admincount()->online_count;
		
		$this->load->model('user_model','user');
		$data['user_count'] = $this->user->get_online_usercount()->online_count;
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'welcome';
		$data['admin'] = $this->session->userdata('admin_user');
		$this->load->view('/sys_admin/global/welcome', $data);
	}
	
	function zhs_platformdata(){
		$this->load->model('systemadmin_model','sa');
		$data = $this->sa->tongji();
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'zhs_platformdata';
		$this->load->view('/sys_admin/global/platform', $data);
	}
	
	function zhs_passwd(){
		$this->load->model('systemadmin_model');
		
		$admin = $this->session->userdata('admin_user');
		$id = $admin['id'];
		$data = $this->systemadmin_model->getone_systemadmin_user("id='$id'");
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'passwd';
		
		$this->load->view('/sys_admin/global/welcome_passwd',$data);
	}
	
	function passwd_edit(){
		$ret['msg'] = '';
		$captcha = $this->input->post ( 'captcha' );
		if ($captcha =="" ){
			$ret['msg'] = '请输入验证码';
			echo json_encode($ret);exit;
		}elseif ($captcha != $_SESSION['captcha']){
			$ret['msg'] = '您输入的验证码不正确';
			echo json_encode($ret);exit;
		}
		else $_SESSION['captcha']="";
		
		$passwd = $this->input->post('password');
		$adminname = $this->input->post('adminname');
		if($passwd == ''){
			$ret['msg'] = '密码不允许为空';
			echo json_encode($ret);exit;
		}
		$data = array(
			'password'   => md5(md5($passwd)),
			'remark'     => $this->input->post('remark')
		);
		
		$data['update_time'] = time();
		$data['update_ip']   = $_SERVER['REMOTE_ADDR'];
		
		$this->load->model('systemadmin_model');
  		$systemset_id = $this->systemadmin_model->update($this->input->post('id'),$data);
  		$this->load->model('log_model');
  		$this->log_model->add_log($adminname.'[修改管理员密码][全局管理]');
  		$ret['url'] = '/sys_admin/logout';
  		echo json_encode($ret);
   		exit;
	}

	function clear_memcache(){
		if($_GET){
			$this->load->driver('cache'); 
			$str=$this->cache->memcached->clean(); 
			$data['msg']='完成清除';
		}

		$data['tab'] = $this->tab;
		$data['sub'] = 'clear_cache';
		$this->load->view('/sys_admin/global/clear_memcache',$data);
	}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
    
	private $tab = 'global';
	function __construct(){
		parent::__construct();
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	
	function index(){
		// 简单运营数据
		/***
		 * 统计在线人数，模糊统计，登陆 30分钟内的人数
		 * */
		$this->load->model('systemadmin_model','sa');
		$data['admin_count'] = $this->sa->get_online_admincount()->online_count;
		
		$this->load->model('user_model','user');
		$data['user_count'] = $this->user->get_online_usercount()->online_count;
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'welcome';
		$data['admin'] = $this->session->userdata('admin_user');
		$this->load->view('/sys_admin/global/welcome', $data);
	}
	
	function zhs_platformdata(){
		$this->load->model('systemadmin_model','sa');
		$data = $this->sa->tongji();
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'zhs_platformdata';
		$this->load->view('/sys_admin/global/platform', $data);
	}
	
	function zhs_passwd(){
		$this->load->model('systemadmin_model');
		
		$admin = $this->session->userdata('admin_user');
		$id = $admin['id'];
		$data = $this->systemadmin_model->getone_systemadmin_user("id='$id'");
		
		$data['tab'] = $this->tab;
		$data['sub'] = 'passwd';
		
		$this->load->view('/sys_admin/global/welcome_passwd',$data);
	}
	
	function passwd_edit(){
		$ret['msg'] = '';
		$captcha = $this->input->post ( 'captcha' );
		if ($captcha =="" ){
			$ret['msg'] = '请输入验证码';
			echo json_encode($ret);exit;
		}elseif ($captcha != $_SESSION['captcha']){
			$ret['msg'] = '您输入的验证码不正确';
			echo json_encode($ret);exit;
		}
		else $_SESSION['captcha']="";
		
		$passwd = $this->input->post('password');
		$adminname = $this->input->post('adminname');
		if($passwd == ''){
			$ret['msg'] = '密码不允许为空';
			echo json_encode($ret);exit;
		}
		$data = array(
			'password'   => md5(md5($passwd)),
			'remark'     => $this->input->post('remark')
		);
		
		$data['update_time'] = time();
		$data['update_ip']   = $_SERVER['REMOTE_ADDR'];
		
		$this->load->model('systemadmin_model');
  		$systemset_id = $this->systemadmin_model->update($this->input->post('id'),$data);
  		$this->load->model('log_model');
  		$this->log_model->add_log($adminname.'[修改管理员密码][全局管理]');
  		$ret['url'] = '/sys_admin/logout';
  		echo json_encode($ret);exit;
   		exit;
	}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}